package com.wxg.toolkit.util;


public class ResUtils {

	/**
	 * 获得系统资源路径
	 * 
	 * @param fuzzyPath
	 * @param force
	 * @return
	 */
	public static String getResourcePath(String fuzzyPath, boolean force){
		String disposePath = null;
		if(force){
			disposePath = fuzzyPath.replaceAll("\\.", "/");
		}else{
			if(fuzzyPath.contains(".")){
				String extension = null; String pkgpath = null;
				extension = fuzzyPath.substring(fuzzyPath.lastIndexOf("."));
				pkgpath = fuzzyPath.substring(0, fuzzyPath.lastIndexOf("."));
				pkgpath = pkgpath.replaceAll("\\.", "/");
				disposePath = pkgpath + extension;
			}else{
				disposePath = fuzzyPath;
			}
		}
		ClassLoader clazzloader = ResUtils.class.getClassLoader();
		return clazzloader.getResource(disposePath).getPath();
	}
}
